package com.estun.backroundManagementService.modules.position.model;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.estun.backroundManagementService.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 工位表
 * </p>
 *
 * @author machine
 * @since 2023-02-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("position")
@ApiModel(value = "Position对象", description = "工位表")
public class Position extends BaseEntity {

    @ApiModelProperty(value = "工位名称")
    private String name;

    @ApiModelProperty(value = "工站描述")
    private String remark;

    @ApiModelProperty(value = "物料编号")
    private String materialIds;

    @TableField(exist = false)
    private List<String> materialIdList;

    @ApiModelProperty(value = "生产线编号")
    private Long productLineId;

    @ApiModelProperty(value = "工站编号")
    private String stationId;

    public void setMaterialIdList(List<String> materialIdList) {
        this.materialIds = JSON.toJSONString(materialIdList);
        this.materialIdList = materialIdList;
    }

    public void setMaterialIds(String materialIds) {
        this.materialIdList = JSON.parseArray(materialIds, String.class);
        this.materialIds = materialIds;
    }
}
